package com.charging.system.service.impl;

import java.util.List;
import com.charging.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.charging.system.mapper.KxChargingSchemeMapper;
import com.charging.system.domain.KxChargingScheme;
import com.charging.system.service.IKxChargingSchemeService;

/**
 * 充电规则Service业务层处理
 *
 * @author charging
 * @date 2024-04-19
 */
@Service
public class KxChargingSchemeServiceImpl implements IKxChargingSchemeService
{
    @Autowired
    private KxChargingSchemeMapper kxChargingSchemeMapper;

    /**
     * 查询充电规则
     *
     * @param chargingSchemeId 充电规则主键
     * @return 充电规则
     */
    @Override
    public KxChargingScheme selectKxChargingSchemeByChargingSchemeId(Long chargingSchemeId)
    {
        return kxChargingSchemeMapper.selectKxChargingSchemeByChargingSchemeId(chargingSchemeId);
    }

    /**
     * 查询充电规则列表
     *
     * @param kxChargingScheme 充电规则
     * @return 充电规则
     */
    @Override
    public List<KxChargingScheme> selectKxChargingSchemeList(KxChargingScheme kxChargingScheme)
    {
        return kxChargingSchemeMapper.selectKxChargingSchemeList(kxChargingScheme);
    }

    /**
     * 新增充电规则
     *
     * @param kxChargingScheme 充电规则
     * @return 结果
     */
    @Override
    public int insertKxChargingScheme(KxChargingScheme kxChargingScheme)
    {
        kxChargingScheme.setCreateTime(DateUtils.getNowDate());
        return kxChargingSchemeMapper.insertKxChargingScheme(kxChargingScheme);
    }

    /**
     * 修改充电规则
     *
     * @param kxChargingScheme 充电规则
     * @return 结果
     */
    @Override
    public int updateKxChargingScheme(KxChargingScheme kxChargingScheme)
    {
        kxChargingScheme.setUpdateTime(DateUtils.getNowDate());
        return kxChargingSchemeMapper.updateKxChargingScheme(kxChargingScheme);
    }

    /**
     * 批量删除充电规则
     *
     * @param chargingSchemeIds 需要删除的充电规则主键
     * @return 结果
     */
    @Override
    public int deleteKxChargingSchemeByChargingSchemeIds(Long[] chargingSchemeIds)
    {
        return kxChargingSchemeMapper.deleteKxChargingSchemeByChargingSchemeIds(chargingSchemeIds);
    }

    /**
     * 删除充电规则信息
     *
     * @param chargingSchemeId 充电规则主键
     * @return 结果
     */
    @Override
    public int deleteKxChargingSchemeByChargingSchemeId(Long chargingSchemeId)
    {
        return kxChargingSchemeMapper.deleteKxChargingSchemeByChargingSchemeId(chargingSchemeId);
    }
}
